// app.js
App({
    onLaunch() {
        // 展示本地存储能力
        const logs = wx.getStorageSync('logs') || []
        logs.unshift(Date.now())
        wx.setStorageSync('logs', logs)

        // 登录
        wx.login({
            success: res => {
                // 发送 res.code 到后台换取 openId, sessionKey, unionId
            }
        })
        wx.getSystemInfo({
            success: res => {
                // 苹果X及以上的底部安全区域
                if (res.safeArea.top > 20) {
                    this.globalData.bottomLift = res.screenHeight - res.safeArea.bottom + this.globalData.tabbarHeight;
                } else {
                    this.globalData.bottomLift = this.globalData.tabbarHeight;
                }
            },
            fail: err => {
                console.log(err);
            }
        })
    },
    globalData: {
        userInfo: null,
        tabbarHeight: 50,
        bottomLift: 0 //苹果X及以上的底部小黑条高度
    }
})